package com.yeyks.common.em;

/**
 * @author fuchangshuai
 * @date 2019/08/19 17:29
 */
public enum WebSocketTypeEnum {
    ORDER(1, "新订单推送"),
    ROB_ORDER(2, "抢单"),
    INFORM(3, "入住通知"),
    ORDER_REFUND(4, "订单退款"),
    ROB_ORDER_RESULT(5, "抢单结果"),
    B2C_ORDER_SUCCESS(10, "b2c下单成功");

    int value;
    String desc;

    WebSocketTypeEnum(int value, String desc) {
        this.value = value;
        this.desc = desc;
    }

    public Integer value() {
        return this.value;
    }

    public String desc() {
        return this.desc;
    }

    public static String getDesc(int value) {
        for (WebSocketTypeEnum webSocketTypeEnum : values()) {
            if (webSocketTypeEnum.value() == value) {
                return webSocketTypeEnum.desc();
            }
        }
        return null;
    }

    public static int getValue(String desc) {
        for (WebSocketTypeEnum webSocketTypeEnum : values()) {
            if (webSocketTypeEnum.desc().equals(desc)) {
                return webSocketTypeEnum.value();
            }
        }
        return 0;
    }
}
